package edu.sctu.zhangwang.month201506.day20150614;

import java.io.*;

/**
 * Created by Administrator on 2015/6/14.
 */
public class InputStream {
    int a = 0;
    int count;
    FileInputStream fileInputStream;
//    FileOutputStream fileOutputStream;
    byte[] bytes = new byte[1024];
    public void input(){
        try {
            fileInputStream = new FileInputStream(new File("E://my_file/zhangwang.txt"));
//            fileOutputStream = new FileOutputStream("E://my_file/ter.txt");
            try {
                while ((count =fileInputStream.read(bytes)) != -1){
                    a +=count;
                    String b = new String(bytes,0,count,"utf-8");
                    System.out.println(b);
                }
                System.out.println(a);
//                fileOutputStream.write(bytes);
                fileInputStream.close();
//                fileOutputStream.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        InputStream inputStream = new InputStream();
        inputStream.input();
    }
}
